@extends('backend::layout')
@section('title',$page_title)
@section('content')
    @component('backend::component.table.table-content')
        @slot('page_title') {{$page_title}} @endslot
        @slot('tools_btn')
            <a href="{{route('b_Article_addArticle')}}"  class="btn btn-primary btn-sm">
                <i class="hcl hcl-add-page"></i>&nbsp;添加文章
            </a>
        @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <div class="media-list  position-relative">
                    <div class="table-responsive">
                        <table class="table table-padded table-xl mb-0">
                            <thead>
                            <tr>
                                <th class="border-top-0">
                                    @component('backend::component.checkbox')
                                        @slot('name') ids-all @endslot
                                    @endcomponent
                                </th>
                                <th class="border-top-0">标题</th>
                                <th class="border-top-0">概述</th>
                                <th class="border-top-0">浏览量</th>
                                <th class="border-top-0">发布时间</th>
                                <th class="border-top-0">状态</th>
                                <th class="border-top-0">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                    @foreach($list as $item)

                                    <tr>
                                        <td class="text-truncate">
                                            @component('backend::component.checkbox')
                                                @slot('name') id[] @endslot
                                                @slot('class') id @endslot
                                                @slot('value') {{$item->id}} @endslot
                                            @endcomponent
                                        </td>
                                        <td class="text-truncate text-more-hide">
                                            @component('backend::component.a')
                                                @slot('href') {{route('b_Article_article',['id'=>$item->id])}} @endslot
                                                @slot('title'){{$item->title}}@endslot
                                                @slot('class') modal-box @endslot
                                                @slot('params') {"area":"80%,80%","title":"文章内容"} @endslot
                                            @endcomponent
                                        </td>
                                        <td class="text-truncate text-more-hide" style="max-width:150px;">
                                            @component('backend::component.a')
                                                @slot('href') {{route('b_Article_article',['id'=>$item->id])}} @endslot
                                                @slot('title'){{$item->subtitle}}@endslot
                                                @slot('class') modal-box @endslot
                                                @slot('params') {"area":"80%,80%","title":"文章内容"} @endslot
                                            @endcomponent
                                        </td>
                                        <td>
                                            {{$item->click}}
                                        </td>
                                        <td class="text-truncate">
                                            <span>{{$item->updated_at->toDateString()}}</span>
                                        </td>
                                        <td>
                                           @component('backend::component.switch')
                                               @if($item->is_open == 1)
                                                    @slot('checked') checked @endslot
                                                @endif
                                                @slot('off') 关闭 @endslot
                                                @slot('on') 发布 @endslot
                                               @slot('params'){"url":"{{route('b_Article_switchArticle',['id'=>$item->id])}}"}@endslot
                                            @endcomponent
                                        </td>
                                        <td class="text-truncat mr-1">
                                            @component('backend::component.form.button')
                                                @slot('elem') a @endslot
                                                @slot('href') {{route('b_Article_editArticle',['id'=>$item['id']])}} @endslot
                                                @slot('btn') btn @endslot
                                                @slot('color') info @endslot
                                                @slot('icon') hcl-edit @endslot
                                            @endcomponent

                                            @component('backend::component.form.button')
                                                @slot('class') btn-ajax @endslot
                                                @slot('color') danger @endslot
                                                @slot('params') {"confirm":true,"url":"{{route('b_Article_delArticle',['id'=>$item['id']])}}"} @endslot
                                                @slot('icon') hcl-remove @endslot
                                            @endcomponent
                                        </td>
                                    </tr>
                    @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            @else
                @include('backend::public.empty_page',['info'=>'暂时没有文章'])
            @endif
        @endslot
    @endcomponent
@endsection